Placing a Browser Control on a Form
Description
The following procedure describes the process of placing the Microsoft Web Browser (shell.explorer) ActiveX control on a form.
Open a form in the Form Editor.
Select the tool shown below from the Toolbox and draw a rectangle on the form. This displays the Insert ActiveX Control dialog.
Select the "Microsoft Web Browser" control and click Insert.
Right click on the ActiveX control and select Properties... .
Note the Object name found on the Setup tab.
Close the ActiveX Properties dialog.
Right click on the form's background and select Events > OnInit.
Assuming that the control's name is activeX1, enter the following Xbasic code.
DIM w1 as P w1 = activeX1.ActiveX.this hourglass_cursor(.t.) if (url <> "") then on error goto w_error w1.navigate(url) on error goto 0 end if hourglass_cursor(.f.) end w_error: ui_msg_box("Error","Invalid URL.",UI_STOP_SYMBOL)
Click 'V' to display the Variable Definition dialog.
Define the URL variable and give it a default value.
Drag the URL variable from the Drag Drop list onto the form.
Click the '-' button to place a button on the form.
Label the button "Go" and place the same code shown above under its OnPush event.
Save your work and switch to form view. The form should look something like this:
See Also